# this script automatically apply reverb on all AIFF sounds in snds folder
import os, time
sons = [son for son in os.listdir(getSoundPath()) if os.path.splitext(son)[1] == '.aif']

# run this part for each sound
for son in sons:
    # to know sound duration
    info = getSoundInfo(son)
    dur = info[2] + 4
    playSound(sound=son, pitch=1, loop=False, amplitude=0.75, duration=dur, out=1)
    convolveReverb(input=1, impulse='ORTFFloorR10.wav', amplitude=0.75, mix=.1, buffersize=256, duration=dur)
    # add 'Rev' to sound name
    name = os.path.splitext(son)[0] + 'Rev'
    startCsound(dur, name)
    time.sleep(1) # wait a little bit
    clear() # clear all values in ounklib (functions library)
